<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<!-- Favicons -->
<link rel="shortcut icon" th:href="@{/assets/images/favicon.ico}">
<link rel="stylesheet" th:href="@{/assets/css/vendor/vendor.min.css}">
<link rel="stylesheet" th:href="@{/assets/css/plugins/plugins.min.css}">
<link rel="stylesheet" th:href="@{/assets/css/style.min.css}">
<script th:src="@{/assets/js/vendor.min.js}"></script>
<script th:src="@{/assets/js/plugins.min.js}"></script>
<!--Main JS-->
<script th:src="@{/assets/js/main.js}"></script>
<script type="text/javascript" th:src="@{/assets/js/jquery-3.2.1.slim.min.js}"></script>
<script type="text/javascript" th:src="@{/assets/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/assets/js/axios.min.js}"></script>

<body>
<!-- Header Section Start -->
<div class="header section" th:fragment="head">

    <!--第一层导航栏 -->
    <div class="header-top bg-name-primary">
        <div class="container">
            <div class="row align-items-center">
                <!-- 欢迎语 -->
                <div class="col-12 col-lg-6">
                    <div class="header-top-msg-wrapper">
                        <p class="header-top-message">欢迎来到牛牛的宠物乐园 !</p>
                    </div>
                </div>

                <!-- 登陆、注册、退出 -->
                <div class="col-12 col-lg-6">
                    <div class="header-top-settings">
                        <ul class="nav">
                            <li class="curreny-wrap">
                                <a href="#" th:if="${session.user != null}" th:text="${session.user.userName}"></a>
                                <a href="#" th:if="${session.user == null}">未登录</a>
                                <i class="fa fa-angle-down"></i>
                                <ul class="dropdown-list curreny-list">
                                    <li><a th:href="@{/login.html}" th:if="${session.user}==null">登录</a></li>
                                    <li><a th:href="@{/register.html}" th:if="${session.user}==null">注册</a></li>
                                    <li><a th:href="@{/exit}" th:unless="${session.user}==null">退出登录</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
                <div >
                    <input id="isLogin" th:if="${session.user != null}" type="hidden" th:value="${session.user.userId}">
                </div>

            </div>
        </div>
    </div>
    <!--第二层模块导航栏 -->
    <div class="header-bottom">
        <div class="header-sticky">
            <div class="container">
                <div class="row align-items-center position-relative">
                    <!-- logo图片，点击显示主页面 -->
                    <div class="col-lg-3 col-md-4 col-6">
                        <div class="header-logo">
                            <a th:href="@{/goods/show}"><img th:src="@{/assets/images/logo/PetLogo.png}" alt="Site Logo"/></a>
                        </div>
                    </div>
                    <!-- 模块导航栏 -->
                    <div class="col-lg-6 d-none d-lg-block">
                        <div class="main-menu">
                            <ul>
                                <li class="has-children">
                                    <a th:href="@{/goods/show}">首页</a>
                                </li>
                                <li class="has-children position-static">
                                    <a th:href="@{/shop.html}">商城</a>
                                </li>
                                <li class="has-children">
                                    <a th:href="@{/hospital}">宠物医院</a>
                                </li>
                                <li class="has-children">
                                    <a th:href="@{/article/list}">知识星球</a>
                                </li>
                                <li class="has-children">
                                    <a href="javascript:void(0)" th:onclick="goDynamic()">社区论坛</a>
                                </li>
                                <li><a th:href="@{/about.html}">关于我们</a></li>
                            </ul>
                        </div>
                    </div>

                    <!-- Header Action Start -->
                    <div class="col-lg-3 col-md-8 col-6">
                        <div class="header-actions">

                            <!-- 个人中心按钮 -->
                            <a th:href="@{/order/list}" class="header-action-btn header-action-btn-wishlist">
                            <a href="javascript:void(0)" th:onclick="goAccount()" class="header-action-btn header-action-btn-wishlist">
                                <i class="icon-user icons"></i>
                            </a>

                            <!-- 购物车按钮 -->
                            <div class="header-action-btn header-action-btn-cart d-none d-sm-flex">
                                <a class="cart-visible" href="javascript:void(0)" th:onclick="goCarts()">
                                    <i class="icon-handbag icons"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script>

        let isLogin = $("#isLogin").val()

        function goAccount() {

            if(isLogin == undefined){
               alert("请先登录！！！")
            }else {
                location="Http://localhost:9001/order/list"
            }
        }

        function goCarts() {

            if(isLogin == undefined){
                alert("请先登录！！！")
            }else {
                location="Http://localhost:9001/cart/carts"
            }
        }

        function goDynamic() {

            if(isLogin == undefined){
                alert("请先登录！！！")
            }else {
                location="Http://localhost:9001/dynamic"
            }
        }

    </script>


</div>











</body>

</html>